// Learn cc.Class:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html

var server_connetcion = require("ServerConnection");
var common = require("Common");
cc.Class({
    extends: cc.Component,

    properties: {
        address_node:cc.Node,
        http_address:cc.EditBox,
        ws_address:cc.EditBox,
    },

    onLoad () {
        Global.login = this;
	},

    login_onclick:function () {
       // cc.director.loadScene('lobby');
       server_connetcion.login();
    },
     
    show_address_btn_onclick:function(){
        this.address_node.active = true;
    },

    address_confirm_onclick:function(){    
        server_connetcion.ip = this.http_address.string;
        server_connetcion.wsServer = this.ws_address.string;
    },

    address_cancle_onclick:function(){
        this.address_node.active = false;
    },

});
